package com.lrs.java.j2se_self.lastJava;
import java.io.*;

public class TestException {
	public static void main(String[] args){
		/*
		try{
			System.out.println(1/0);	
		}catch(ArithmeticException e){
			e.printStackTrace();
			System.out.println("chu cuo le!");
		}
		*/	
		TestException t = new TestException ();
		//t.m(0);
		
	
		try{
			t.m(0);
		}catch(ArithmeticException e){
			System.out.println(e.getMessage());
			
		}finally{
			System.out.println("文件错了!");
			
		}
		
		/*
		FileInputStream in = null ;
		try {
			in = new FileInputStream("test.java");
			int b = in.read();
			while(b != -1){
				System.out.println((char)b);
				b = in.read();
			}
		}catch(FileNotFoundException e){
			e.printStackTrace();
		}catch(IOException e ){
			System.out.println(e.getMessage());
		}finally{
			try{
				in.close();
			}catch(IOException e1){
				e1.printStackTrace();
			}
		}
		*/
		System.out.println("文件错了!");
	}
	
	public void m(int i) throws ArithmeticException {
		if(i == 0 ){
			throw new ArithmeticException ("出错了！");
		}
	}
}
